<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 *
 * @author Joker
 * `tcompany_id` int(11) NOT NULL DEFAULT 0 COMMENT '教程编号 对应teaches_company 表',
	`url` varchar(255) NOT NULL COMMENT '原文件路径',
	`size` decimal(10,2) DEFAULT NULL COMMENT '大小 单位MB',
	`user_id` int(11) NOT NULL COMMENT '上传者编号',
	`file_name` varchar(100) NOT NULL COMMENT '生成的文件名',
	`file_path` varchar(255) NOT NULL COMMENT '生成的文件的所属文件夹路径',
	`pdf_url` varchar(255) DEFAULT NULL COMMENT '生成的pdf路径',
	`swf_url` varchar(255) DEFAULT NULL COMMENT '生成的swf路径',
	`type` char(50) DEFAULT NULL COMMENT '附件类型',
 */
class TeachesCompanyOffice extends Model
{
    use SoftDeletes;
    
    protected $table="teaches_company_office";
    
    protected $primaryKey = 'tcompany_id';
    
    protected $fillable = ['id','tcompany_id','url','size','user_id','file_name','file_path','pdf_url','swf_url','type'];
    
    protected $dates = ['deleted_at'];
    
    /**
     * 与用户一对一关联
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
    */
    public function users()
    {
        return $this->hasOne('App\User','id','user_id');
    }
}